In computer science, pointers are a fundamental form of indirection. Instead of holding a value directly, a pointer variable holds the memory address—the specific location in RAM—where that value is stored. This allows programs to coordinate changes to a single source of truth without expensive data duplication.
1. The Logic of the Address
The location where a value is stored is known as its memory address. Understanding this is the first step in speaking the computer's internal language. In Go, we use the ampersand (&) to find an address and the asterisk (*) to follow it.
2. Why Indirection Matters
Indirection is a powerful tool for building complex, shared data structures. Imagine a shop sign directing visitors to a new address. The sign doesn't contain the shop; it tells you where to look. Go provides a safe environment for mastering this: if you've encountered pointers before, take a deep breath. This isn't going to be so bad. If this is your first encounter, relax. Go is a safe place to learn pointers.